#ifndef PAGEACCUMLATIONS_H
#define PAGEACCUMLATIONS_H

#include <QWidget>
#include <QLineEdit>
#include <QKeyEvent>
#include <QEvent>
#include <QTimer>
#include "slimnumkeyboard.h"
#include "global_def.h"

namespace Ui {
class PageAccumlations;
}

class PageAccumlations : public QWidget
{
    Q_OBJECT

public:
    explicit PageAccumlations(QWidget *parent = nullptr);
    ~PageAccumlations();
    void setPageActive(bool xActive);
    void setDayDistance(uint val);
    void setTotalRunTime(uint val);
    void setTotalDistance(uint val);
    void setTotalACRunTime(uint8_t index,uint32_t totaltime);
    void setTotalEnergyConsume(uint32_t energy);
    void setProEnergyConsume(uint32_t energy);
    void setAuxEnergyConsume(uint32_t energy);
    void setRegEnergyConsume(uint32_t energy);
    void setHVACEnergyConsume(uint32_t energy);
    void setBrkResEnergyConsume(uint32_t energy);

    uint getTotalRunTimeInput();
    uint getTotalRunDisInput();
    uint getAirCompTimeInput(uint8_t index);
    uint getProEnergyInput();
    uint getAuxEnergyInput();
    uint getRegEnergyInput();
    uint getBrkResEnergyInput();
protected:
     bool eventFilter(QObject *obj, QEvent *event);
signals:
    void returnToMaintMenu();
    void signal_TotalDisSetValid(bool);
    void signal_TotalTimeSetValid(bool);
    void signal_AirComp1TimeSetValid(bool);
    void signal_AirComp6TimeSetValid(bool);
    void signal_ProEnergySetValid(bool);
    void signal_AuxEnergySetValid(bool);
private slots:
    void on_Btn_Return_clicked();
    void input_slot(int);
    void backspace_slot();
    void cancel_slot();
    void on_Btn_TotalDistanceSet_clicked();
    void on_Btn_TotalRunTimeSet_clicked();
    void on_Btn_CompRunTImeSet1_clicked();
    void on_Btn_CompRunTImeSet4_clicked();
    void on_Btn_ProEnergySet_clicked();
    void on_Btn_AuxEnergySet_clicked();
private:
    Ui::PageAccumlations *ui;
    SlimNumKeyBoard *m_pKeyBoard=nullptr;
    QList<QLineEdit*> inputlist;
    QLineEdit *m_pFocusLinedit=nullptr;
};

#endif // PAGEACCUMLATIONS_H
